# 杨辉三角

class Solution:
    def generate(self, numRows):
        # 先初始化杨辉三角
        c = [[1] * (i + 1) for i in range(numRows)]
        # 从第三行开始
        for i in range(2, numRows):
            for j in range(1, i):
                # 直接把杨辉三角向左对齐即可，便于理解
                c[i][j] = c[i - 1][j - 1] + c[i - 1][j]

        
        return c
    


if __name__ == "__main__":

    n = 5
    sol = Solution()
    res = sol.generate(n)
    print(res)


